<?php

/*
 * Index file
 * In this case the first example file
 */

include "loader.php";

use html\document as doc;
use style\parser as css;
use system\core\selector as selector;

$xhtml = "<html><h1 class=simple bullshiat=notvalid >
	Billo
	<span id='test1'>test<span><b class='isX'>X</b></span></span><br/>
	<span useless but selected>test</span><br/>
	<input type='checkbox' checked /><a href='http://www.test.de'>Das ist ein Test</a>
	There so much more to tell through<b id=12 class='nothing'>this thingi</b>yiiihaw!
</h1>
</html>";

$html = <<<EOF
<html class='basic'>
	<input>
	<input type=button>
	<h1 class='simple test' bullshiat='notvalid' class='more simple'>
		<b>
			<div>
				<input type='other'>
			</div>
			<span class='wooop'>
				Billo
			</span>
		</b>
	</h1>
	<div class='simple'>
		<input class=more type='text'>A Block!
	</div>
</html>
EOF;

$xhtml = <<<EOF
<html>
	<div>
		<b>
			<input>
		</b>
		<h1>
			Test
		</h1>
		<span>
		</span>
	</div>
	<table>
		<tr>
			<td>
			</td><td></td></tr><tr><td><div><b></b></div></td></tr></table>
</html>
EOF;

$html = <<<EOF
<div invalid="attribute" class="test">This <a href="TargetTest">is</a> <a>just</a> a Test!</div>Nothing more please!
EOF;


$css = css::load("testspecial.css");
//print_r($css->refactor());
//exit;
print_r(selector::parser("html>a .cssdingen~.blahblubb>html.mobile"));

new html\core\plugin('filter');
new html\core\plugin('mergecss');

//doc::load("<div><b id='testid' class='fett' class='more'>T<span class='hier'>e</span>st</b></div>")->hasClass("hier");

$res = doc::load("valid.xhtml");
//$res = doc::load($html);
//				$x->plotTags();
//				echo "Selection\n";

//for( $x = 1; $x <= 1000; $x++ )
//{
	$final = $res->select("html");
//}
//$res->plotTags();
$final->plotTags();
$final->each(function($tag,$id){
	echo $id.": ".$tag->getTagname()."\n";
	echo $tag->html()."\n";
	});
//$x->plotTags();
//print_r($x);
//$x->applyCss("testspecial.css");
//$y = $x->select('div>input[type="text"]');
//$y = $x->select('div+span');
//$y->plotTags();
//print_r($y);
exit;
//Plugin::load('html\filter');

$x = doc::load("<html><span class='yesithas'>Test</span></html>");
$clone = clone $x;
//	$y = $clone::load("<b selected=TRUE>It is Bold!</b><foo is='DANCE'>BAR</foo>");
print_r($x);
//	print_r($y);


/*
  //$style = css::load("testspecial.css");
  //echo $style->refactor();
  //$selector = selector::parser("h1 > b[value='done']:first+li,.moreclasses,a li p div.class.over span,h1:not(.blahblah)");
  //$selector = selector::parser('h1~h2,h1+h2:not(.test),p[align="right"][class="intro"]');
  //print_r($selector);
  //echo $selector->readout();
  //exit;

  query::Plugin('core\filter');
  query::Plugin('user\test');
  query::Plugin('user\plotpath');
  print_r(query::html($html));

  exit;
  $x = query::html($html);
  $x->getTag("h1");

  print_r(query::html($x));

  //echo query::html($html)->getTag("h1");
  //echo serialize($obj);
 */
?>
